﻿using System;

namespace RexToy.UI.Controls
{
    public class Container : Control
    {
        protected Control[] __controls;
        public Control[] Controls
        {
            get { return __controls; }
        }

        protected bool __sizeUpdate;
        /// <summary>
        /// if true, parent will resize the control to fill it.
        /// </summary>
        public bool SizeUpdate
        {
            get { return __sizeUpdate; }
            set { __sizeUpdate = value; }
        }

        /// <summary>
        /// have default implement. derive class can call this or override it.
        /// </summary>
        /// <param name="ctrl"></param>   
        public virtual void AppendControl(Control ctrl)
        {
        }

        /// <summary>
        /// have default implement. derive class can call this or override it.
        /// </summary>
        /// <param name="ctrl"></param>
        public virtual void RemoveControl(Control ctrl)
        {
        }

        /// <summary>
        /// have default implement. derive class can call this or override it.
        /// </summary>
        /// <param name="ctrl"></param>
        /// <param name="idx"></param>
        public virtual void InsertControlAt(Control ctrl, uint idx)
        {
        }

        /// <summary>
        /// have default implement. derive class can call this or override it.
        /// </summary>
        public virtual void ClearControls()
        {
        }

        /// <summary>
        /// base feature, notify all children that size is changed, can be call in subclass when override this.
        /// </summary>
        /// <param name="size"></param>
        public override void Render(Size size)
        {
        }
    }
}
